<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePolicyUploadQnTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('policy_upload_qn', function (Blueprint $table) {
            $table->increments('id');
            $table->string('policy_upload_id')->nullable()->comment('pol_policy_upload表的ID');
            $table->char('act_carrier', 8)->nullable()->comment('限制主飞航司');
            $table->date('arrived_at')->comment('到达日期');
            $table->string('depart_date_forbid')->nullable()->comment('无效航班起飞日期');
            $table->string('depart_time_slot')->nullable()->comment('航班起飞时间段');
            $table->string('day_condition')->nullable()->comment('航班班期限制 例:1234567');
            $table->string('forbid_airlines')->nullable()->comment('不适用航线');
            $table->char('no_cabin', 20)->nullable()->comment('不适用仓位');
            $table->string('flight_no_limit',3)->nullable()->comment('航班号限制 不适用 适用 所有');
            $table->string('flight_condition')->nullable()->comment('航班限制条件');
            $table->string('shared',1)->nullable()->comment('支持共享航班 是 否');
            $table->string('stop',1)->nullable()->comment('支持经停航班 是 否');
            $table->string('product_mark')->nullable()->comment('产品类型 非负整数, 逗号分隔的字符串');
            $table->date('sale_start_at')->nullable()->comment('销售开始日期');
            $table->date('sale_end_at')->nullable()->comment('销售结束日期');
            $table->date('sale_forbid_start_at')->nullable()->comment('禁止销售开始日期');
            $table->date('sale_forbid_end_at')->nullable()->comment('禁止销售结束日期');
            $table->string('sale_time_slot')->nullable()->comment('销售时间段');
            $table->integer('lock_time')->nullable()->comment('起飞前截止销售时间');
            $table->integer('earliest_before_ticket')->default(0)->comment('最早提前出票时限');
            $table->integer('before_ticket')->default(0)->comment('最晚提前出票时限');
            $table->tinyInteger('card_type')->default(0)->comment('证件类型,0:所有证件 1:只支持身份证');
            $table->string('support_cba', 1)->nullable()->comment('是否支持儿童买成人 是 否');
            $table->string('print_source',20)->nullable()->comment('运价类型 公布运价 私有运价 直减运价 指定票面价 官网价格 旗舰店价格 飞耶官网价格 飞耶旗舰店价格');
            $table->string('print_compute_type',20)->nullable()->comment('公式计算票面价类型 公式计算票面价(适用舱位) 公式计算票面价(订座舱位)');
            $table->string('x_cabin',20)->nullable()->comment('X代表舱位');
            $table->string('select_type',2)->nullable()->comment('舱位取价 取低 取高');
            $table->decimal('print_return_point')->default(0)->comment('票面价返点');
            $table->integer('print_return_price')->default(0)->comment('票面价留钱');
            $table->string('x_price_type',20)->nullable()->comment('票面价取整 个位向上取整 个位向下取整 个位四舍五入 十位四舍五入 十位五舍六入 十位向上取整 十位向下取整');
            $table->integer('min_print_price')->default(0)->comment('最低票面价');
            $table->integer('max_print_price')->default(0)->comment('最高票面价');
            $table->integer('policy_return_point')->default(0)->comment('政策价返点');
            $table->integer('policy_return_price')->default(0)->comment('政策价留钱');
            $table->decimal('auto_price_threshold', 8, 1)->default(0)->comment('固定追价阈值');
            $table->decimal('percent_price_threshold')->default(0)->comment('百分比追价阈值');
            $table->string('pre_office_no',20)->nullable()->comment('预订Office号 CGO134');
            $table->string('need_pnr',1)->nullable()->comment('是否生成PNR 否 是');
            $table->string('high_demand_type',10)->nullable()->comment('紧俏座位处理 不处理 生pnr 禁售');
            $table->string('high_demand_threshold')->nullable()->comment('紧俏座位阈值');
            $table->string('office_no')->nullable()->comment('搭桥office号');
            $table->string('need_pata',1)->nullable()->comment('是否进行PAT: A校验 否 是');
            $table->string('return_rule',20)->nullable()->comment('退票');
            $table->string('change_rule',20)->nullable()->comment('改签');
            $table->string('endorsement',1)->nullable()->comment('是否允许签转 否 是');
            $table->string('policy_type',20)->comment('政策类型 STOCK');
            $table->tinyInteger('inventory_type')->default(1)->comment('库存类型，1：按照库存销售 2:在Eterm舱位外放时设置最大销售数量');
            $table->tinyInteger('is_back')->default(0)->comment('退票是否还库存，0:否 1:是');
            $table->integer('max_stock')->default(0)->comment('最大可售卖数量');
            $table->integer('remain_stock')->default(0)->comment('剩余可售卖数量');
            $table->string('cabin_dec')->nullable()->comment('舱位说明');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('policy_upload_qn');
    }
}
